import React, {Component} from 'react';
import {StoreProvider} from 'iflux2';
import AppStore from './store';

import ChooseUser from './component/choose-user';
import ChooseGoods from './component/choose-goods';
import CreateTrade from './component/create-trade';


@StoreProvider(AppStore)
export default class ValetOrder extends Component {

    componentDidMount() {
        if (!!this.props.params.tid) {//复制订单操作流程，暂时不考虑，具体请咨询of654
            this.props.store.copyTrade(this.props.params.tid);
        } else {//普通待客下单
            this.props.store.queryUsers();
        }
    }


    render() {
        let step = this.props.store.state().get('step');

        return (
            <div className="order-new">
                {
                    step === 'user' ? <ChooseUser/> : (step === 'goods' ? <ChooseGoods/> : <CreateTrade/>)
                }
            </div>
        )
    }
}